package com.holly.unit.bpmn.designer.enums;

import java.util.Objects;
import java.util.stream.Stream;

/**
 * 类描述: 条件逻辑判断枚举类
 *
 * @author fxr
 * @version 1.0.0
 * @date 2022/5/7 8:50
 */
public enum logicTypeEnum {

    // 并且
    AND("AND"),
    // 或
    OR("OR");

    String fieldName;

    logicTypeEnum(String fieldName) {
        this.fieldName = fieldName;
    }

    public String fieldName() {
        return this.fieldName;
    }

    public static logicTypeEnum of(String fieldName) {
        return Stream.of(logicTypeEnum.values())
                .filter(clazz -> Objects.equals(clazz.fieldName(), fieldName))
                .findFirst()
                .orElse(AND);
    }

}
